home *** CD-ROM | disk | FTP | other *** search
- 10 REM THINGS -- A data program for things to remember
- 20 WIDTH 80
- 25 REM Copyright Richard Boucher 1982
- 30 CLS: COLOR 0,7: LOCATE 5,20: PRINT " THINGS a Basic Program to Remember ":
- 40 LOCATE 10,30: PRINT " By Richard Boucher 11/15/82 "
- 50 COLOR 7,0:
- 55 LOCATE 20,20: PRINT "Press any key to begin"
- 56 GO$ = INKEY$: IF GO$ = "" THEN 56
- 57 CLS
- 60 REM If you want to use several files place "Input file$" here.
- 70 REM and eliminate the next line.
- 80 FILE$ = "Things.dat"
- 90 OPEN FILE$ AS #1 LEN=80
- 100 FIELD #1, 1 AS N$, 14 AS A$, 65 AS B$
- 110 CLS:PRINT "Program called Things.bas":
- 120 GOSUB 1140 'Subroutine to find last entry
- 130 PRINT "Your options are:"
- 140 PRINT: PRINT ,"(R) - READ an entry in the file":
- 150 PRINT ,"(A) - ADD an item to the file":
- 160 PRINT ,"(L) - LIST all the things ":
- 170 PRINT: PRINT ,"(E) - ELIMINATE an entry you're finished with":
- 180 PRINT ,"(I) - List an INDEX of key words in the file":
- 190 PRINT,"(F) - FIND an entry by key word":
- 200 PRINT :PRINT, "(P) - PRINT out entries from the file "
- 210 PRINT, "(S) - Start a new file or blank out an old one
- 220 PRINT ,"(Q) - QUIT": PRINT:
- 230 PRINT "What do you want to do ? ";
- 240 X$ = INKEY$: IF X$ = "" THEN 240
- 250 PRINT X$
- 260 IF X$="S" OR X$="s" THEN 1010
- 270 IF X$="r" OR X$="R" THEN 360
- 280 IF X$="a" OR X$="A" THEN 520
- 290 IF X$="e" OR X$="E" THEN 1290
- 300 IF X$="L" OR X$="l" THEN 660
- 310 IF X$="I" OR X$ = "i" THEN 1390
- 320 IF X$="P" OR X$="p" THEN 1210
- 330 IF X$="f" OR X$="F" THEN 850
- 340 IF X$="Q" OR X$="q" THEN 1130
- 350 CLS:PRINT:PRINT "Bad choice, try again": GOTO 130
- 360 CLS 'Section to read entries one by one
- 370 GOSUB 1150
- 380 PRINT:INPUT "Entry number"; Z
- 390 PR$ = "" : INPUT "Do you want to print this ";PR$
- 400 IF Z>50 THEN PRINT "Too high": GOTO 380
- 410 GET #1, Z
- 420 PRINT:PRINT "Key word: ";A$
- 430 PRINT "Thing : "; B$
- 440 IF PR$ = "Y" OR PR$ = "y" THEN LPRINT A$, B$: LPRINT:
- 450 PRINT:PRINT:PRINT:PRINT:
- 460 PRINT "(R)ead another entry or (E)dit this one or (G)o back to the main menu ":
- 470 GO$ = INKEY$ : IF GO$ = "" THEN 470
- 480 IF GO$="R" OR GO$="r" THEN CLS: GOTO 380
- 490 IF GO$ = "E" OR GO$ = "e" THEN GOSUB 1530: CLS: GOTO 460
- 500 CLS
- 510 GOTO 110
- 520 REM Section to add entries to the file
- 530 CLS: GOSUB 1140
- 540 PRINT: INPUT "Item number";M
- 550 GET #1,M
- 560 IF ASC(N$)<>255 THEN INPUT "Overwrite old entry";O$:IF O$<>"Y" AND O$<>"y" THEN 520
- 570 LSET N$ = CHR$(0)
- 580 PRINT "Key word";:LOCATE ,23:PRINT CHR$(124):LOCATE ,9:INPUT D$
- 590 LSET A$=D$
- 600 ON ERROR GOTO 0
- 610 PRINT "Thing ";:LOCATE ,79:PRINT CHR$(124);:LOCATE ,15:INPUT T$
- 620 LSET B$=T$
- 630 PUT #1,M
- 640 PRINT: PRINT "Another entry (Y/N)";
- 645 GO$ = INKEY$: IF GO$ = "" THEN 645
- 650 PRINT GO$:IF GO$="Y" OR GO$="y" THEN 520 ELSE CLS: GOTO 110
- 660 REM Section to list the entries
- 670 CLS:
- 680 FOR I = 1 TO 46 STEP 5
- 690 Q = I: GOSUB 800
- 700 Q = I+1: GOSUB 800
- 710 Q = I + 2: GOSUB 800
- 720 Q = I + 3: GOSUB 800
- 730 Q = I + 4: GOSUB 800
- 740 PRINT: PRINT:PRINT "Press any key to continue"
- 750 K$=INKEY$: IF K$="" THEN 750
- 760 NEXT I
- 770 PRINT : PRINT "Press any key to go back to main menu"
- 780 K$=INKEY$: IF K$="" THEN 780
- 790 CLS:GOTO 110
- 800 GET #1, Q: IF ASC(N$) = 255 AND ASC(A$) = 0 AND ASC(B$) = 0 THEN 770 ELSE IF ASC(N$) = 255 THEN RETURN
- 810 PRINT: PRINT "Entry number: " Q;
- 820 PRINT ,,"Key word: ";A$
- 830 PRINT "Thing : ";B$
- 840 RETURN
- 850 REM Section to write things by key word
- 860 CLS
- 870 PRINT: INPUT "What is the key word";S$
- 880 INPUT "Do you want to print this out";PR$
- 890 IF LEN(S$)<3 THEN T = LEN(S$) ELSE T = 3
- 900 FOR J=1 TO 50
- 910 GET #1,J
- 920 IF N$=CHR$(255) AND ASC(A$) = 0 THEN 980
- 930 FOR G = 1 TO 8 : LS$ = LEFT$(S$,T): IF LS$ = MID$(A$,G,T) THEN 950
- 940 NEXT G: GOTO 970
- 950 PRINT: PRINT J,A$,B$
- 960 IF PR$="Y" OR PR$="y" THEN LPRINT CHR$(18); J;A$;B$
- 970 NEXT J
- 980 PRINT: PRINT "Press any key to continue"
- 990 K$=INKEY$: IF K$="" THEN 990 ELSE CLS: GOTO 110
- 1000 REM Section to initialize a new file
- 1010 CLS: PRINT :PRINT "You are about the initialize a whole file":
- 1020 PRINT: PRINT: INPUT "Are you sure you want to do this ";SUR$
- 1030 IF SUR$ <> "Y" AND SUR$ <>"y" THEN GOTO 110
- 1040 PRINT: PRINT: INPUT "What should the name be";FILE$
- 1050 CLOSE #1
- 1060 OPEN FILE$ AS #1 LEN=80
- 1070 FIELD#1, 1 AS N$, 14 AS A$, 65 AS B$
- 1080 LSET N$=CHR$(255)
- 1090 FOR I=1 TO 50
- 1100 PUT #1, I
- 1110 NEXT I
- 1120 CLS: GOTO 120
- 1130 CLOSE #1: PRINT:PRINT:PRINT ,,"Bye-bye Baby":PRINT:PRINT,,,"BYE-BYE":END
- 1140 REM Subroutine to find the first blank entry
- 1150 FOR I=1 TO 50
- 1160 GET #1, I
- 1170 IF N$=CHR$(255) THEN 1190
- 1180 NEXT I
- 1190 PRINT: PRINT,;:COLOR 0,7:PRINT " First blank entry is number"; I:COLOR 7,0
- 1200 PRINT: RETURN
- 1210 PRINT: INPUT "Number of the first entry, number of last";U,V
- 1220 INPUT "Single (s) or double space (d)";SP$
- 1230 FOR K=U TO V
- 1240 GET #1, K
- 1250 IF SP$="d" OR SP$="D" THEN LPRINT
- 1260 LPRINT CHR$(18);A$;B$;
- 1270 NEXT K
- 1280 CLS: GOTO 110
- 1290 REM Section to eliminate old entries in field N$
- 1300 CLS: GOSUB 1140
- 1310 PRINT:PRINT:INPUT "Which entry number";N
- 1320 GET #1, N
- 1330 PRINT: PRINT N,A$,B$: PRINT: PRINT:
- 1340 INPUT "Is this the entry which you're finished with (Y/N)";GO$
- 1350 IF GO$="Y" OR GO$="y" THEN LSET N$=CHR$(255):LSET A$ = " "
- 1360 PUT #1, N
- 1370 CLS: PRINT: INPUT "Finished another entry ";GO$
- 1380 IF GO$="y" OR GO$="Y" THEN 1310 ELSE CLS: GOTO 110
- 1390 REM Subroutine to list the key words
- 1400 CLS
- 1410 PRINT "Item","Key Word",,"Item","Key word":PRINT:
- 1420 FOR I = 1 TO 49 STEP 2
- 1430 GET #1, I
- 1440 IF N$=CHR$(255) THEN 1460
- 1450 PRINT I,A$;
- 1460 GET #1, I+1
- 1470 IF N$=CHR$(255) THEN 1490
- 1480 PRINT ,I+1,A$
- 1490 NEXT I
- 1500 PRINT: PRINT:PRINT "Press any key to return to main menu"
- 1510 GO$ = INKEY$:IF GO$="" THEN 1510
- 1520 GOTO 110
- 1530 CLS: PRINT "Editing entry number ";Z:PRINT,, "PRESS ENTER TO RETAIN THE PRESENT ENTRY":
- 1540 PRINT ,, "Or, enter changes after going to the end of the line": PRINT:PRINT:
- 1550 PRINT "Key word: ";A$
- 1560 X = CSRLIN -1
- 1570 LOCATE X,10
- 1580 INPUT "",TEMP$
- 1590 IF TEMP$ <> "" THEN LSET A$ = TEMP$
- 1600 LOCATE X+2,1: TEMP$ = ""
- 1610 PRINT "Thing: " ; B$
- 1620 X = CSRLIN - 1
- 1630 LOCATE X,8
- 1640 INPUT "",TEMP$
- 1650 IF TEMP$<>"" THEN LSET B$ = TEMP$
- 1660 PUT #1, Z
- 1670 PRINT:PRINT:PRINT: RETURN